package JDBCapi;


import java.sql.*;

public class test
{
	public static void main(String[] args) throws ClassNotFoundException, SQLException
	{
		String url = "jdbc:mysql://47.115.170.26:3306/scott";
		String username = "lixixi";
		String password = "AsDjunhui886";
		Class.forName("com.mysql.cj.jdbc.Driver");
		Connection conn = DriverManager.getConnection(url, username, password);

		String select = "select * from emp";
		Statement stmt = conn.createStatement();
		ResultSet rs = stmt.executeQuery(select);
		while(rs.next())
		{
			System.out.printf("%06d ",rs.getInt("empno"));
			System.out.print(rs.getString("ename") + " ");
			System.out.print(rs.getString("job") + " ");
			System.out.print(rs.getString("mgr") + " ");
			System.out.print(rs.getDate("hiredate") + " ");
			System.out.print(rs.getDouble("sal") + " ");
			System.out.print(rs.getDouble("comm") + " ");
			System.out.print(rs.getInt("deptno") + " ");
			System.out.println();
		}
	}
}
